package exercise;

import java.util.Random;

/**
 * 特征值计算
 * 找最大值 最小值 总和 平均值  并输出
 */
public class EigenvalueCalculation {
    public static void main(String[] args) {
        int a = 10;
        int b = 99;
        // 获取[a, b]范围内的随机数
        // int random = (int)(Math.random() *(b-a+1))+a;
        int[] arr = new int[10];
        int max = a, min = b, sum = 0;
        for (int i = 0; i < arr.length; i++) {
            arr[i] = (int) (Math.random() * (b - a + 1)) + a;
            if (max < arr[i])
                max = arr[i];
            if (min > arr[i])
                min = arr[i];
            sum += arr[i];
            System.out.print(arr[i] + "\t");
        }
        System.out.println();
        System.out.println("最大值：" + max);
        System.out.println("最小值：" + min);
        System.out.println("总和：" + sum);
        System.out.println("平均值：" + (double) sum / 10);


    }
}
